home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / others / wnbrag.zip / WINBRAG.PAS < prev    next >
Pascal/Delphi Source File  |  1991-01-28  |  4KB  |  114 lines

  1. program New_win_com;
  2.  
  3.  
  4. var wincom            :   file;
  5.     newwincom         :   file;
  6.     splashscreen      :   file;
  7.     splashscreenName  :   string[64];
  8.     WinComName        :   string[64];
  9.     Buff              :   array [1..$11e0] of byte;
  10.     NumRead,
  11.     NumWritten        :   word;
  12.     actual            :   integer;
  13.     CrapOut           :   boolean;
  14.  
  15. begin
  16.  
  17. CrapOut := false;
  18.  
  19. writeln('WinBrag v0.10 : Written by Paul Delys, 73500,2777');
  20. writeln('                Create your own Windows 3.0 Brag Screen');
  21. writeln;
  22. writeln('                Read Startup.txt by Mike Mezaros (75500,655) for');
  23. writeln('                the gory details, history, and inspiration for this');
  24. writeln('                simple program.  Thanks and credit also belong to');
  25. writeln('                Charles Kistler (72137,775), the developer (or');
  26. writeln('                discoverer!) of the working algorithm.');
  27. writeln;
  28. if paramcount = 0 then begin
  29.   writeln('Usage:   WINBRAG [RLE filename]');
  30.   writeln;
  31.   writeln('         [RLE Filename] is the RLE file you want to');
  32.   writeln('         use as your startup screen for Windows 3.0.');
  33.   writeln;
  34.   writeln('         WIN.COM must be in the current directory.');
  35.   writeln('         NEWWIN.COM is created and should be used as your');
  36.   writeln('         new Windows startup file.  NEWWIN.COM may be renamed');
  37.   writeln('         or copied to any other filename (including WIN.COM).');
  38.   Writeln('         NEWWIN.COM should be in your Windows directory when');
  39.   writeln('         you try to run Windows.');
  40. end;
  41.  
  42. {---get rle file name  }
  43.   if paramcount < 1 then begin
  44.     writeln;
  45.     write('Enter name of RLE file to use:  ');
  46.     readln(splashscreenname);
  47.   end else
  48.     splashscreenname := paramstr(1);
  49.  
  50.   if splashscreenname = '' then CrapOut := true;
  51.  
  52. {---set up splash screen file  }
  53.   if not CrapOut then begin
  54.     assign(splashscreen,splashscreenname);
  55.     {$I-} reset(splashscreen,1) {$I+};
  56.  
  57.     Actual := IOResult;
  58.     if Actual <> 0 then begin
  59.       writeln('File ',splashscreenname,' not found.');
  60.       CrapOut := True;
  61.     end;
  62.     if (not CrapOut) and (FileSize(SplashScreen) > $ffff-$11e0) then begin
  63.       Writeln('File ',splashscreenname,' is to large to use as a brag screen.');
  64.       Write(  'The maximum size RLE file that may be used is ');
  65.       writeln($ffff-$11e0-1,' bytes.');
  66.       CrapOut := true;
  67.     end;
  68.   end;
  69.  
  70. {---set up win.com  }
  71.   wincomname := 'win.com';
  72.  
  73.   assign(wincom,wincomname);
  74.   {$I-} reset(wincom,1) {$I+} ;
  75.   Actual := IOResult;
  76.   if Actual <> 0 then begin
  77.     writeln(WinComName,' not found.');
  78.     writeln('Make sure ',wincomname,' is in the current directory.');
  79.     CrapOut := true;
  80.   end;
  81.  
  82. {--- set up new win.com file  }
  83.   assign(newwincom,'newwin.com');
  84.   {$I-} rewrite(newwincom,1) {$I+};
  85.   actual := IOResult;
  86.   if actual <> 0 then begin
  87.     writeln('NEWWIN.COM not created.');
  88.     CrapOut := true;
  89.   end;
  90.  
  91.  
  92.   if not CrapOut then begin
  93.     blockread(wincom,buff,$11e0,NumRead);
  94.     blockwrite(newwincom,buff,NumRead,NumWritten);
  95.  
  96.     repeat
  97.       BlockRead(SplashScreen,Buff,$11e0,NumRead);
  98.       BlockWrite(NewWinCom,buff,NumRead,NumWritten);
  99.     until (NumRead=0) or (NumRead<>NumWritten);
  100.  
  101.     if paramcount > 0 then begin
  102.       writeln;
  103.       writeln('NEWWIN.COM is ready to use.');
  104.     end;
  105.  
  106.   end;
  107.  
  108.   {$I-} close(newwincom) {$I+}; actual := IOResult;
  109.   {$I-} close(splashscreen) {$I+}; actual := IOResult;
  110.   {$I-} close(wincom) {$I+}; actual := IOResult;
  111.  
  112.  
  113. end.
  114.